<template>
<view class="dynamic-comment-publish-page st-bg-color-white">
  <commentPublish :subject-id="momentId" :group-flag="$config.dynamicGroupFlag" @saveSuccess="goBack" @publishSuccess="goBack"></commentPublish>
</view>
</template>

<script>
/**
 *
 */
import commentPublish from '../../../../../../../components/comment/web/components/app/uni-app/st-u-comment-subject-publish/st-u-comment-subject-publish.vue'
export default {
  components: {commentPublish},
  data(){
    return {
      // 上一个页面传递一动态id
      momentId: ''
    }
  },
  onLoad(options){
    this.momentId = options.momentId
  },
  methods: {
    // 只有发布成功才有 comment 参数
    goBack(comment){
      // 延时一下返回，因为动作太快，导致提示信息一闪而过
     setTimeout(()=>{
       uni.navigateBack({
         delta: 1,
         success(res){
           // 向上个页面传递发布完的数据
           if (comment) {
             uni.$emit('commentPublishSuccess', comment)
           }
         }
       })
     },1000)
    },
  }

}
</script>

<style scoped>
page{
  background-color: #FFFFFF;
}
</style>